package com.example.rabbitmqdemo.controller;

import com.example.rabbitmqdemo.producer.MessageProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {

    @Autowired
    private MessageProducer messageProducer;

    @GetMapping("/send1")
    public String sendMessage(@RequestParam String message) {
        messageProducer.sendMessageToQueues1(message);
        return "Message sent1: " + message;
    }

    @GetMapping("/send2")
    public String sendMessage2(@RequestParam String message) {
        messageProducer.sendMessageToQueues2(message);
        return "Message sent2: " + message;
    }

    @GetMapping("/sendvip")
    public String sendMessageVip(@RequestParam String message) {
        messageProducer.sendvipMessage(message);
        return "Message sentvip: " + message;
    }
    @GetMapping("/sendNormal")
    public String sendMessageNormal(@RequestParam String message) {
        messageProducer.sendnormalMessage(message);
        return "Message sentNormal: " + message;
    }
    @GetMapping("/sendDelayed")
    public String sendMessageDelayed(@RequestParam String message) {
        messageProducer.sendDelayedMessage(message);
        return "Message sentDelayed: " + message;
    }
}    